<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="headerFragment(title,active)">
    <meta charset="utf-8"/>
    <title><th:block th:text="${title!=null?title:'博客后台'}"></th:block></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta content="Coderthemes" name="author"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <link rel="shortcut icon" th:href="@{/user/img/bloglogo.jpg}"/>
    <link th:href="@{/back/css/bootstrap.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/back/css/font-awesome.min.css}" rel="stylesheet"/>
    <link th:href="@{/back/css/style.min.css}" rel="stylesheet" type="text/css"/>
    <link th:href="@{/back/css/sweetalert2.min.css}" rel="stylesheet"/>

    <script th:src="@{/back/js/html5shiv.js}"></script>
    <script th:src="@{/back/js/respond.min.js}"></script>
</head>
<div th:fragment="header-body">
<div class="topbar">
    <div class="topbar-left">
        <div class="text-center p-t-10" style="margin: 0 auto;">
            <div class="pull-left" style="padding-left: 10px;">
                <a th:href="@{/admin/index}">
                    <img th:src="@{/user/img/bloglogo.jpg}" width="50" height="50"/>
                </a>
            </div>
            <div class="pull-left" style="padding-left: 10px;">
                <span style="font-size: 28px; color: #2f353f; line-height: 50px;">MyBlog</span>
            </div>
        </div>
    </div>
    <div class="navbar navbar-default" role="navigation">
        <div class="container">
            <div class="">
                <div class="pull-left">
                    <button type="button" class="button-menu-mobile open-left">
                        <i class="fa fa-bars"></i>
                    </button>
                    <span class="clearfix"></span>
                </div>

                <ul class="nav navbar-nav navbar-right pull-right">
                    <li class="dropdown">
                        <a th:href="@{index.html}" class="dropdown-toggle profile" data-toggle="dropdown"
                           aria-expanded="true"><img th:src="@{/assets/img/me.jpg}" alt="user-img"
                                                     class="img-circle"/> </a>
                        <ul class="dropdown-menu">
                            <form name="logoutform" th:action="@{/logout}" method="post"></form>
                            <li><a th:href="@{${commons.site_url()}}" target="_blank">
                                <i class="fa fa-eye"  th:href="@{/}"></i>查看网站</a></li>
<!--                            <li ><a href="javascript:document.logoutform.submit();" >-->
                            <li ><a href="javascript:document.logoutform.submit();" >
                            <i class="fa fa-sign-out" ></i> 退出登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<div class="left side-menu">
    <div class="sidebar-inner slimscrollleft">
        <div id="sidebar-menu">
            <ul>
                <li th:class="${active}=='home'?'active':''">
                    <a th:href="@{/admin/index}"
                       th:class="${active}=='home'?'waves-effect active':'waves-effect'"><i
                            class="fa fa-dashboard" aria-hidden="true"></i><span> 仪表盘 </span></a>
                </li>
                <li th:class="${active}=='publish'?'active':''">
                    <a th:href="@{/admin/article/toEditPage}"
                       th:class="${active}=='publish'?'waves-effect active':'waves-effect'"><i
                            class="fa fa-pencil-square-o" aria-hidden="true"></i><span> 发布文章 </span></a>
                </li>
                <li th:class="${active}=='article'?'active':''">
                    <a th:href="@{/admin/article}"
                       th:class="${active}=='article'?'waves-effect active':'waves-effect'"><i
                            class="fa fa-list" aria-hidden="true"></i><span> 文章管理 </span></a>
                </li>
                <!-- 以下功能尚未实现 -->
                <li th:class="${active}=='comments'?'active':''">
                    <a th:href="@{/admin/comments}"
                    <a th:class="${active}=='comments'?'waves-effect active':'waves-effect'">
                        <i class="fa fa-comments" aria-hidden="true"></i><span > 评论管理 </span></a>
<!--                </li>-->
<!--                <li th:class="${active}=='category'?'active':''">-->
<!--                    <a th:class="${active}=='category'?'waves-effect active':'waves-effect'">-->
<!--                        <i class="fa fa-tags" aria-hidden="true"></i><span> 分类/标签 </span></a>-->
<!--                </li>-->

<!--                <li th:class="${active}=='setting'?'active':''">-->
<!--                    <a th:class="${active}=='setting'?'waves-effect active':'waves-effect'">-->
<!--                        <i class="fa fa-gear" aria-hidden="true"></i><span> 系统设置 </span></a>-->
<!--                </li>-->
            </ul>
            <div class="clearfix"></div>
        </div>
        <div class="clearfix"></div>
    </div>
</div>
</div>
<script>
    function confirmExit() {
        // 使用 confirm() 函数弹出确认框
        if (confirm("你确定要退出吗？")) {
            // 如果用户点击确认按钮，这里是退出操作的代码
            document.logoutform.submit();
            console.log("用户已确认退出。");
        } else {
            // 如果用户点击取消按钮，这里是取消退出操作的代码
            console.log("用户已取消退出。");
        }
    }
</script>
</html>
